{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "e1b694bd",
   "metadata": {},
   "source": [
    "————————————————————————————————————————————\n",
    "* AI-NLP：自然语言处理（Natural language processing）\n",
    "* date：week09\n",
    "-----------------------------------------------------------"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "14816ec4",
   "metadata": {},
   "source": [
    "# 本周内容\n",
    "## 自然语处理\n",
    "      "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4f1dd2ba",
   "metadata": {},
   "source": [
    "### 1.什么是语言？\n",
    "1.语言的本身      \n",
    "2.语言的隐喻\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "27b02d48",
   "metadata": {},
   "source": [
    "### 2.什么是自然语言处理？\n",
    "1.Machin Translation（机器翻译）：谷歌、有道翻译                 \n",
    "2.Chinese word segmentation（中文自动分词）：锤子手机大爆炸           \n",
    "3.Question Answering（问答系统）：openai、文言一心                    \n",
    "4.Information Extracting（信息抽取）                  \n",
    "5.Reading comprehension（阅读理解）                              \n",
    "6.Automic summarization（自动摘要）                   \n",
    "7.Text categorization(文本分类)              "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5b842a1d",
   "metadata": {},
   "source": [
    "### 3. 计算机也能理解语言吗"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f9a93622",
   "metadata": {},
   "source": [
    "### 4.词向量是什么"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0545e040",
   "metadata": {},
   "source": [
    "## 百度AI实践\n",
    "> 1.自然语言处理文本信息（实践）         \n",
    "> 2.自然语言生成文本信息（实践）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "60c1d56a",
   "metadata": {},
   "source": [
    "## 对话机器人\n",
    "> 1.对话机器人（实践）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f9c8c8b6",
   "metadata": {},
   "source": [
    "## 接入openAI"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "5be9d314",
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests,json"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "3547af7b",
   "metadata": {},
   "outputs": [],
   "source": [
    "url = 'http://openapi.turingapi.com/openapi/api/v2'\n",
    "data = {\n",
    "    \"reqType\":0,\n",
    "    \"perception\": {\n",
    "        \"inputText\": {\n",
    "            \"text\": \"聊点什么呢\"\n",
    "        },\n",
    "        \"inputImage\": {\n",
    "            \"url\": \"\"\n",
    "        },\n",
    "\n",
    "    },\n",
    "    \"userInfo\": {\n",
    "        \"apiKey\": \"d5d5bb66f66d4da8bedb378df7adfa70\",\n",
    "        \"userId\": \"111\"\n",
    "    }\n",
    "}\n",
    "\n",
    "r = requests.post(url,json.dumps(data))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "0c6e0d82",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Response [200]>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "4611939b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'emotion': {'robotEmotion': {'a': 0, 'd': 0, 'emotionId': 0, 'p': 0},\n",
       "  'userEmotion': {'a': 0, 'd': 0, 'emotionId': 0, 'p': 0}},\n",
       " 'intent': {'appKey': 'platform.chat', 'code': 0, 'operateState': 1100},\n",
       " 'results': [{'groupType': 0,\n",
       "   'resultType': 'text',\n",
       "   'values': {'text': '当然是聊你感兴趣的啊'}}]}"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "350dc6f8",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
